import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WinContentVO, WinContentForm, WinContentQuery } from '@/api/business/winContent/types';

/**
 * 查询飘窗信息列表
 * @param query
 * @returns {*}
 */

export const listWinContent = (query?: WinContentQuery): AxiosPromise<WinContentVO[]> => {
  return request({
    url: '/business/winContent/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询飘窗信息详细
 * @param baseId
 */
export const getWinContent = (baseId: string | number): AxiosPromise<WinContentVO> => {
  return request({
    url: '/business/winContent/' + baseId,
    method: 'get'
  });
};

/**
 * 新增飘窗信息
 * @param data
 */
export const addWinContent = (data: WinContentForm) => {
  return request({
    url: '/business/winContent',
    method: 'post',
    data: data
  });
};

/**
 * 修改飘窗信息
 * @param data
 */
export const updateWinContent = (data: WinContentForm) => {
  return request({
    url: '/business/winContent',
    method: 'put',
    data: data
  });
};

/**
 * 删除飘窗信息
 * @param baseId
 */
export const delWinContent = (baseId: string | number | Array<string | number>) => {
  return request({
    url: '/business/winContent/' + baseId,
    method: 'delete'
  });
};
/**
 * 是否展示
 */
export const visibleChange = (baseIds: Array<string | number>, status: boolean) => {
  return request({
    url: '/business/winContent/visible',
    method: 'post',
    data: {
      baseIds: baseIds,
      status: status
    }
  });
};
